<?php
function getFormatEdition($edition)
{	
	$result = str_replace('st', '<sup>st</sup>', $edition);
	$result = str_replace('nd', '<sup>nd</sup>', $result);
	$result = str_replace('rd', '<sup>rd</sup>', $result);
	$result = str_replace('th', '<sup>th</sup>', $result);			
	return $result;
}

function getLastName($name)
{
	$lastName = "";
	$temp = str_replace('`', ' ', $name);
	$splitName = explode(' ', $temp);						
	$countSplitName = count($splitName);
	if ($countSplitName > 0)
	{
		$lastName = $splitName[$countSplitName - 1];
		$length = strlen($lastName);
		if ($length > 0)
		{
			$lastName = strtoupper($lastName[0]) . strtolower(substr($lastName, 1));
		}
	}		
	
	return $lastName;			
}

function getInitialFirstName($name)
{
	$initial = "";
	$temp = str_replace('`', ' ', $name);
	$splitName = explode(' ', $temp);			
	$countSplitName = count($splitName);
	if ($countSplitName > 0)
	{
		$initial = strtoupper($splitName[0]);
		$initial = $initial[0];
	}
	return $initial;
}

function doubleQuoteJS($text)
{
	$result = str_replace('"', '\\"', $text);
	return $result;
}
?>